package com.woke.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.woke.data.Datas_myinfo;
import com.woke.method.Intentnet;
import com.zhongcai.online.R;

import java.util.ArrayList;
import java.util.List;

public class Myinfoadater extends BaseAdapter{
	private LayoutInflater mInflater;
	private List<Datas_myinfo> datalist;

	public Myinfoadater(LayoutInflater minflater, ArrayList<Datas_myinfo> datalist) {
		this.mInflater = minflater;
		this.datalist = datalist;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return datalist.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}
	
	class Holder {
		TextView mText_money;
		TextView mText_for;
		TextView mText_order;
		TextView mText_time;
		TextView mText_date;
		ImageView mImage1;
		ImageView mImage2;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Holder holder = null;
		if(convertView == null){
			holder = new Holder();
			convertView = mInflater.inflate(R.layout.item_myifo, null);
			holder.mText_money = (TextView) convertView.findViewById(R.id.item_myinfo_right);
			holder.mText_for = (TextView) convertView.findViewById(R.id.item_myinfo_left);
			holder.mImage1 = (ImageView) convertView.findViewById(R.id.item_myinfo_image);
			convertView.setTag(holder);
		}else{
			 holder = (Holder) convertView.getTag();
		}
		
		Datas_myinfo data = datalist.get(position);
		String time = Intentnet.getStrTime1(data.addtime);
		if(data.is_read.equals("2")){
			holder.mImage1.setImageResource(R.drawable.avmyinfo_image_read2);
		}else{
			holder.mImage1.setImageResource(R.drawable.avmyinfo_image_read1);
		}
		holder.mText_money.setText(time);
		holder.mText_for.setText(data.title);
//		Double money = Double.valueOf(data.quota_money);
//		Double reust = money / 10000;
//		holder.mText_money.setText(reust+"��");
		return convertView;
	}

}
